package com.jiyun.service;

import com.jiyun.dao.StudentMapper;
import com.jiyun.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentService {
    @Autowired(required = false)
    private StudentMapper mapper;

    public List<Student> getAll(){
        return mapper.selectAll();
    }

    public void addStudent(Student student){
        mapper.insert(student);
    }

    public void updateStudent(Student student){
        mapper.updateByPrimaryKey(student);
    }

    public void deleteStudent(int id){
        mapper.deleteByPrimaryKey(id);
    }
}
